let arr = [
  {
    arr1: ['黑色', '白色', '红色']
  },
  {
    arr1: ['S', 'M']
  },
  {
    arr1: ['男', '女']
  }
];
// 变成 [{color "黑色", version:"S" , sex :"男"}, {color "黑色", version:"S", sex:"女"}] ]
function trans(arr) {
  let res = [];
  let temp = [];
  let len = arr.length;
  let index = 0;
  function dfs(index) {
    if (index === len) {
      res.push(temp.slice());
      return;
    }
    for (let i = 0; i < arr[index].arr1.length; i++) {
      temp.push(arr[index].arr1[i]);
      dfs(index + 1);
      temp.pop();
    }
  }
  dfs(index);
  return res;
}

console.log(trans(arr));
